Cricket.Search = {
				Cache: {cachekeys: [], results: [], totals: []},
				getCacheKey: function(Tab, Month, Team) {
					var CacheKey = Tab + '_' + Month + '_' +Team;
					return CacheKey;
				},
				checkCache: function(CacheKey) {
					for(var i = 0; i < Cricket.Search.Cache.cachekeys.length; i++) {
						if(Cricket.Search.Cache.cachekeys[i] === CacheKey) {
							return i;
						}
					}
					return false;
				},
				filter: function(ForObject) {
					var CacheKey 	= this.getCacheKey(ForObject.TabId, ForObject.CurrentMonth, ForObject.CurrentTeam);
					var CacheExists = this.checkCache(CacheKey);
					if(false !== CacheExists) {		
						var Result 			= Cricket.Search.Cache.results[CacheExists];
						TotalResults 		= Cricket.Search.Cache.totals[CacheExists];
					} else {
						var dataToSearch = ForObject.ParsedFeed;
						var Result = [];
						Month = ForObject.CurrentMonth;
						Team = ForObject.CurrentTeam;
						if(false != dataToSearch) {
							if('' != Month) {
								//create date object
								var DateToSearch = new Date();
								var MonthArray = Month.split('-');
								if(2 == MonthArray.length) {
									DateToSearch.setDate(1);
									DateToSearch.setMonth(parseInt(MonthArray[0]));
									DateToSearch.setYear(parseInt(MonthArray[1]));
									
								} else {
									DateToSearch = '';
								}
							} else {
								DateToSearch = '';
							}
							for(var s = 0; s < dataToSearch.length; s++) {
								if('' != DateToSearch) {
									AddToResultDate = false;
									MonthToCompare 		= DateToSearch.getMonth();
									MonthToCompareStart = dataToSearch[s].Dates.Start.getMonth();
									MonthToCompareEnd 	= dataToSearch[s].Dates.End.getMonth();
									if(MonthToCompare >= MonthToCompareStart && MonthToCompare <= MonthToCompareEnd) {
										//now check year
										YearToCompare = DateToSearch.getFullYear();
										//letsd not worry about the END year
										YearToCompareStart 	= dataToSearch[s].Dates.Start.getFullYear()
										YearToCompareEnd 	= dataToSearch[s].Dates.End.getFullYear()
										if(YearToCompare >= YearToCompareStart && YearToCompare <= YearToCompareEnd) {
											AddToResultDate = true;
										}										
									}									
								} else {
									AddToResultDate = true;
								}
								
								if('' != Team) {			
									AddToResultTeam = false;						
									//check if one of teams is the team we're looking for
									if(Team === dataToSearch[s].Teams[1].fullname || Team === dataToSearch[s].Teams[2].fullname) {
										AddToResultTeam = true;
									}
								} else {
									AddToResultTeam = true;
								}
								
								if(true === AddToResultTeam && true === AddToResultDate) {
									Result.push(dataToSearch[s]);
								}
							}
							
						} 
						//dont cache live
						if('live' != ForObject.TabId) {
							Cricket.Search.Cache.cachekeys.push(CacheKey);
							Cricket.Search.Cache.results.push(Result);
							Cricket.Search.Cache.totals.push(Result.length);
						}
					}
					return Result;
				}
			}